#ifndef DISC_H_
#define DISC_H_

#include "Element.h"

namespace p2 {

class Disc: public Element
{
DECLARE_RTT(Disc, Element);

public:
	inline Disc(real mass, Vector2<real> localPosition, real localAngle,
		p2Material const& material, uint32 plane, void* userData);
	virtual ~Disc();

	static Disc* create(real mass, Vector2<real> position, real rotation,
			p2Material const& material, uint32 plane, void* userData);

	/*
	 * Element
	 */
	virtual bool updateShapeData();
	virtual void updateMotionBounds(real64 dT);
	virtual void updateWorldSpace();
	virtual bool contains(Vector2<real> worldPoint);

	/*
	 * access
	 */
	inline real getRadius() const;
	inline void setRadius(real radius);

private:
	real _radius;
};

inline Disc::Disc(real mass, Vector2<real> localPosition, real localAngle,
	p2Material const& material, uint32 plane, void* userData)
	:   Element(mass, localPosition, localAngle, material, plane, userData),
		_radius((real)0)
{
}

inline real Disc::getRadius() const
{
    return _radius;
}

inline void Disc::setRadius(real radius)
{
    _radius = radius;
    _halfExtent = Vector2<real>(_radius, _radius);
}

}

#endif	//DISC_H_
